import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    title: '表名',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '表备注',
    dataIndex: 'comment',
    customRender: ({ record }) => {
      return record.comment || '暂无表备注';
    },
    width: 120,
  },
  {
    title: '存在主键',
    dataIndex: 'havePrimaryKey',
    customRender: ({ record }) => {
      const [color, text] = [
        record.havePrimaryKey ? 'green' : 'default',
        record.havePrimaryKey ? '存在' : '不存在',
      ];
      return h(Tag, { color }, () => text);
    },
    width: 120,
  },
  {
    title: '实体名称',
    dataIndex: 'entityName',
    width: 120,
  },
  {
    title: '控制层名称',
    dataIndex: 'controllerName',
    width: 120,
  },
  {
    title: '控制层名称',
    dataIndex: 'serviceName',
    width: 120,
  },
  {
    title: '控制层名称',
    dataIndex: 'serviceImplName',
    width: 120,
  },
  {
    title: '持久层名称',
    dataIndex: 'mapperName',
    width: 120,
  },
  {
    title: 'MapperXML名称',
    dataIndex: 'xmlName',
    width: 120,
  },
];

/*
comment: ""
commonFields: []
controllerName: "ActAppDatabasechangelogController"
convert: true
entityName: "ActAppDatabasechangelog"
entityPath: "actAppDatabasechangelog"
fieldNames: "ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID"
fields: [{convert: false, keyFlag: false, keyIdentityFlag: false, name: "ID", type: "varchar(255)",…},…]
havePrimaryKey: false
importPackages: ["com.baomidou.mybatisplus.annotation.TableName", "java.io.Serializable", "java.time.LocalDateTime"]
mapperName: "ActAppDatabasechangelogMapper"
name: "act_app_databasechangelog"
serviceImplName: "ActAppDatabasechangelogServiceImpl"
serviceName: "IActAppDatabasechangelogService"
xmlName: "ActAppDatabasechangelogMapper"

*/

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '表名',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'comment',
    label: '表备注',
    component: 'Input',
    colProps: { span: 8 },
  },
];
